apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  {{- include "helm_lib_module_labels" (list . (dict "app.kubernetes.io/component" "server" "app.kubernetes.io/name" "argocd-server" "app.kubernetes.io/part-of" "argocd" "app" "argocd-server")) | nindent 2 }}
  name: d8:delivery:argocd:server
rules:
  - apiGroups:
      - '*'
    resources:
      - '*'
    verbs:
      - delete
      - get
      - patch
  - apiGroups:
      - ""
    resources:
      - events
    verbs:
      - list
  - apiGroups:
      - ""
    resources:
      - pods
      - pods/log
    verbs:
      - get
  - apiGroups:
      - argoproj.io
    resources:
      - applications
    verbs:
      - get
      - list
      - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  {{- include "helm_lib_module_labels" (list . (dict "app.kubernetes.io/component" "server" "app.kubernetes.io/name" "argocd-server" "app.kubernetes.io/part-of" "argocd" "app" "argocd-server")) | nindent 2 }}
  name: d8:delivery:argocd:server
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: d8:delivery:argocd:server
subjects:
  - kind: ServiceAccount
    name: argocd-server
    namespace: d8-{{ .Chart.Name }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  {{- include "helm_lib_module_labels" (list . (dict "app.kubernetes.io/component" "server" "app.kubernetes.io/name" "argocd-server" "app.kubernetes.io/part-of" "argocd" "app" "argocd-server")) | nindent 2 }}
  name: argocd:server
  namespace: d8-{{ .Chart.Name }}
rules:
  - apiGroups:
      - ""
    resources:
      - secrets
      - configmaps
    verbs:
      - create
      - get
      - list
      - watch
      - update
      - patch
      - delete
  - apiGroups:
      - argoproj.io
    resources:
      - applications
      - appprojects
      - applicationsets
    verbs:
      - create
      - get
      - list
      - watch
      - update
      - delete
      - patch
  - apiGroups:
      - ""
    resources:
      - events
    verbs:
      - create
      - list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  {{- include "helm_lib_module_labels" (list . (dict "app.kubernetes.io/component" "server" "app.kubernetes.io/name" "argocd-server" "app.kubernetes.io/part-of" "argocd" "app" "argocd-server")) | nindent 2 }}
  name: argocd:server
  namespace: d8-{{ .Chart.Name }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: argocd:server
subjects:
  - kind: ServiceAccount
    name: argocd-server
---
apiVersion: v1
kind: ServiceAccount
metadata:
  {{- include "helm_lib_module_labels" (list . (dict "app.kubernetes.io/component" "server" "app.kubernetes.io/name" "argocd-server" "app.kubernetes.io/part-of" "argocd" "app" "argocd-server")) | nindent 2 }}
  name: argocd-server
  namespace: d8-{{ .Chart.Name }}
